package com.linys.scala.study.pattern

/**
  * Created by admin on 2019/10/15.
  */
object Test {

  def main(args: Array[String]) {
    //println(matchTest(555))
    //println(matchTest(1))
    //println(matchTest(2))
    //println(matchTest(3))
    //println(matchTest(4))

    println(matchTest2("two"))
    println(matchTest2("test"))
    println(matchTest2(1))
    println(matchTest2(6))

  }
  def matchTest(x: Int): String = x match {
    case 1 => "one"
    case 2 => "two"
    case _ => "many"
  }

  def matchTest2(x: Any): Any = x match {
    case 1 => "one"
    case "two" => 2
    case y: Int => "scala.Int"
    case _ => "many"
  }

}
